[WRONG BRANCH] fix(service): bind lifecycle to CODEX_SQLITE_HOME - #263
[WRONG BRANCH] fix(service): bind lifecycle to CODEX_SQLITE_HOME#263luvs01 wants to merge 1 commit into
Conversation
|
Warning Review limit reached
Next review available in: 20 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Comment |
|
✅ Deterministic PR hygiene checks passed. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 016a93e725
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| version: 2, | ||
| codexHome: currentCodexHome(), | ||
| opencodexHome: currentOpenCodexHome(), | ||
| codexSqliteHome: resolveCodexSqliteHome({ codexHome: currentCodexHome() }), |
There was a problem hiding this comment.
Bind relative SQLite homes to a stable service directory
When config.toml contains a relative sqlite_home, this records the path resolved against the installer's process.cwd(), but the generated plist, systemd unit, and Windows launcher do not preserve that working directory. The supervised process can therefore resolve the same configuration to another database, while a later command run from the installation directory passes this ownership check and restores the recorded—but wrong—database. Preserve a stable working directory in the service artifact or otherwise ensure the recorded path is exactly the one the child uses, with regression coverage for relative sqlite_home.
AGENTS.md reference: src/AGENTS.md:L10-L10
Useful? React with 👍 / 👎.
| if (state.codexSqliteHome !== undefined) { | ||
| const actualCodexSqliteHome = resolveCodexSqliteHome({ codexHome: actualCodexHome }); |
There was a problem hiding this comment.
Treat SQLite resolution failures as ownership failures
When config.toml is unreadable or has an invalid sqlite_home, this resolver throws a plain Error before the service manager is contacted. The ocx stop path in src/cli/index.ts only sets ownershipBlocked for ServiceOwnershipError, so it treats this as an ordinary stop failure and continues into native Codex restoration and Grok cleanup while the installed service remains registered and may still be running. Convert this indeterminate resolution into the fail-closed ownership representation so callers skip shared teardown.
Useful? React with 👍 / 👎.
⏳ DRAFT
What to do
Its title has been prefixed with |
Motivation
CODEX_SQLITE_HOMEinto artifacts but the install-state did not record it, allowing laterocx service stop/uninstall/repairruns from shells with different or absentCODEX_SQLITE_HOMEto target the wrong SQLite database.Description
codexSqliteHomefield toServiceInstallStateand accept it inparseServiceInstallStatewith validation to reject empty strings. (importedresolveCodexSqliteHome)writeServiceInstallState(...)so the install-state reflects the actual history target used by the baked service artifacts.assertServiceEnvironmentMatchesInstall()to compare the recordedcodexSqliteHometo the current resolved SQLite home and fail-closed if they differ, preventing lifecycle operations from mutating a different DB.tests/service.test.tsto validate rejecting lifecycle operations when the recorded SQLite home does not match the current environment and to restoreCODEX_SQLITE_HOMEenv in cleanup.Testing
bun x tsc --noEmit/bun run typecheckand it succeeded.bun run privacy:scanand it passed.bun test tests/service.test.tsand the new regression (mismatched SQLite home) passed.bun run test/bun scripts/test.ts; the full run produced many passing tests and exercised the service suites, while a pre-existing unrelated assertion in the service diagnostics surface was observed separately during full-suite runs (the targeted service tests passed).Codex Task